<template>
	<view :class="isDark?'darkBg':''">
		<cu-custom :bgColor="isDark?'bg-black':'bg-gradual-blue'">
			<!-- <block slot="backText">返回</block> -->
			<block slot="content">我的</block>
		</cu-custom>
		<view :class="isDark?'dark':''">

			<!-- <ad unit-id="adunit-9d7d942b0b847762"></ad>
 -->
			<view>
				<view style="margin-right: 30rpx;margin-left: 30rpx;margin-top:30rpx;border-radius:20px;">
					<view class="UCenter-bg  " :class="isDark?'wrap':''" style="border-top-left-radius: 10px;
border-top-right-radius: 10px;">
						<view class="avatar" style="background-image:url('https://web.cloudduolc.cn/image/noUser.png')">
						</view>
						<button class="nickname" @click="login()"> {{username}}</button>

					</view>
					<view :class="isDark?'darkIn':'bg-white'" style="height: 320rpx;border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;">
						<view :class="isDark?'darkIn':'bg-white'" style="height: 25rpx;"></view>
						<view style="height: 275rpx; ;margin-left:40rpx;margin-right:40rpx;border-radius:10px;"
							:class="isDark?'dark':'vipbg'">
							<!-- <view style="height: 30rpx;"></view> -->
							<view style="display: flex;">
								<view style="margin-top: 30rpx;"> <text
										style="font-weight:400;font-size: 30rpx;margin:30rpx;letter-spacing:4rpx;" v-if="isVIP==false">LV0</text>
										<text
												style="font-weight:400;font-size: 30rpx;margin:30rpx;letter-spacing:4rpx;" v-if="isVIP==true">VIP</text>
								</view>
								<view style="float: right;margin-left:340rpx;display: flex;margin-top: 10rpx;"
									@click="showVIP">

									<view style="margin-top: 10rpx;"><text style="font-size: 20rpx;">会员权益</text> </view>
									<view>
										<image src="../../static/my/right.png" class="rightIcon"></image>
									</view>
								</view>
							</view>
							<view class="margin-left" style="margin-top: 20rpx;"><text
									style="font-size: 20rpx;color: grey;" v-if="isVIP==false"> 10/100</text><text
									style="font-size: 20rpx;color: grey;" v-if="isVIP==true"> 100/100</text></view>

							<view style="display: flex;">
								<view class="cu-progress round margin-left margin-top-sm" style="width: 60%;"
									:class="isDark?'dark':''">

									<view class="bg-green" style=" width:10%;" v-if="isVIP==false"></view>
									<view class="bg-green" style=" width:100%;" v-if="isVIP==true"></view>
								</view>
								<view style="float: right;margin-left:70rpx" @click="showPublicCode">
									<view><text class="lg text-gray cuIcon-qrcode"
											style="margin-left: 5rpx;font-size: 67rpx;"></text></view>
									<view><text style="font-size: 20rpx;">公众号码</text></view>
								</view>
							</view>
							<view class="margin-left" style="margin-top: 0rpx;"><text style="font-size: 20rpx;" v-if="isVIP==false">
									关注右方的公众号即可成为VIP（可长按图片识别）</text><text style="font-size: 20rpx;" v-if="isVIP==true">
									已成为VIP</text></view>

						</view>
						<!-- 	<view style="background-color: #ffffff;height: 25rpx;"></view> -->
					</view>

				</view>
				<view class="padding" style="border-radius: 30rpx;">
					<view class="cu-bar  solid-bottom"
						style="border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;"
						:class="isDark?'darkIn':'bg-white'">
						<view class="action">
							用户服务
						</view>
					</view>
					<view class="cu-list grid col-4 no-border "
						style="border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;"
						:class="isDark?'':'bg-white'">
						<view class="cu-item" v-if="state.studentNumber=='1'">
							<navigator class="funcBtn" url="/pages/bind/login/no">
								<view class="cuIcon-people text-blue">
								</view>
								<text>绑定用户</text>
							</navigator>
						</view>

						<view class="cu-item" v-if="state.password=='1'">
							<navigator class="funcBtn" url="/pages/bind/login/index">
								<view class="cuIcon-unlock text-green">
								</view>
								<text>用户登录</text>
							</navigator>
						</view>
						<view class="cu-item" v-if="state.lover=='1'">
							<navigator class="funcBtn" url="/pages/bind/loverBind/no">
								<view class="cuIcon-friendfill text-pink">
								</view>
								<text>情侣绑定</text>
							</navigator>

						</view>
						<view class="cu-item" v-if="state.setting=='1'">
							<navigator class="funcBtn" url="/pages/user/setting">
								<view class="cuIcon-settings text-purple">
								</view>
								<text>用户设置</text>
							</navigator>

						</view>
					</view>

				</view>



				<view class="padding" style="border-radius: 30rpx;" v-if="client=='WECHAT'&&state.KF=='1'">
					<view class="cu-bar solid-bottom"
						style="border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;"
						:class="isDark?'darkIn':'bg-white'">
						<view class="action">
							客服服务
						</view>
					</view>
					<view class="cu-list grid col-4 no-border "
						style="border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;"
						:class="isDark?'':'bg-white'">
						<view class="cu-item">
							<button open-type="contact" style="background-color:transparent;margin-top: -40rpx;">
								<view class="cuIcon-friendadd text-red"></view>
								<text :class="isDark?'text-white':'text-gray'" style="margin-top: -20rpx;">需求反馈</text>
							</button>
						</view>
						<view class="cu-item">
							<button open-type="contact" style="background-color:transparent;margin-top: -40rpx;">
								<view class="cuIcon-questionfill text-grey"></view>
								<text :class="isDark?'text-white':'text-grey'" style="margin-top: -20rpx;">异常反馈</text>
							</button>
						</view>
						<view class="cu-item">
							<button open-type="contact" style="background-color:transparent;margin-top: -40rpx;">
								<view class="cuIcon-friendadd text-cyan"></view>
								<text :class="isDark?'text-white':'text-gray'" style="margin-top: -20rpx;">友情合作</text>
							</button>
						</view>
						<view class="cu-item ">
							<button open-type="contact" style="background-color:transparent;margin-top: -40rpx;">
								<view class="cuIcon-dianhua text-orange"></view>
								<text :class="isDark?'text-white':'text-gray'" style="margin-top: -20rpx;">联系客服</text>
							</button>
						</view>


					</view>

				</view>

				<view class="padding" style="border-radius: 30rpx;">
					<view class="cu-bar  solid-bottom"
						style="border-top-left-radius: 30rpx;border-top-right-radius: 30rpx;"
						:class="isDark?'darkIn':'bg-white'">
						<view class="action">
							系统服务
						</view>
					</view>
					<view class="cu-list grid col-4 no-border "
						style="border-bottom-left-radius: 30rpx;border-bottom-right-radius: 30rpx;"
						:class="isDark?'':'bg-white'">
						<view class="cu-item" @click="chat()" v-if="client!='WECHAT'">
							<navigator class="funcBtn" url="">
								<view class="cuIcon-dianhua text-pink">
								</view>
								<text>联系客服</text>
							</navigator>
						</view>
						<view class="cu-item" @click="clean()" v-if="state.clean=='1'">
							<navigator class="funcBtn" url="">
								<view class="cuIcon-loading text-mauve">
								</view>
								<text>清除缓存</text>
							</navigator>

						</view>
						<view class="cu-item" v-if="state.from=='1'">
							<navigator class="funcBtn" url="/pages/user/from">
								<view class="cuIcon-searchlist text-blue">
								</view>
								<text>数据来源</text>
							</navigator>

						</view>
						<view class="cu-item" v-if="state.advise=='1'">
							<navigator class="funcBtn" url="/pages/user/advise">
								<view class="cuIcon-list text-brown">
								</view>
								<text>更新建议</text>
							</navigator>

						</view>
						<view class="cu-item" @click="code()" v-if="state.gitee=='1'">
							<navigator class="funcBtn" url="">
								<view class="cuIcon-github text-grey">
								</view>
								<text>代码开源</text>
							</navigator>
						</view>
						<view class="cu-item" v-if="state.download=='1'">
							<navigator class="funcBtn" url="/pages/custom/download/index">
								<view class="cuIcon-refresharrow text-yellow">
								</view>
								<text>下载地址</text>
							</navigator>
						</view>
						<view class="cu-item" @click="use()" v-if="state.use=='1'">
							<navigator class="funcBtn" url="">
								<view class="cuIcon-appreciate text-red">
								</view>
								<text>使用说明</text>
							</navigator>
						</view>
						<!-- 		<view class="cu-item ">
							<button open-type="contact" style="background-color:transparent;margin-top: -40rpx;">
								<view class="cuIcon-dianhua text-purple"></view>
								<text :class="isDark?'text-white':'text-gray'" style="margin-top: -20rpx;">联系客服</text>
							</button>
						</view> -->
						<view class="cu-item" v-if="state.thank=='1'">
							<navigator class="funcBtn" url="/pages/user/thank">
								<view class="cuIcon-emoji text-blue">
								</view>
								<text>关于致谢</text>
							</navigator>
						</view>
						<view class="cu-item" v-if="state.about=='1'">
							<navigator class="funcBtn" url="/pages/user/about">
								<view class="cuIcon-my text-gray">
								</view>
								<text>关于我们</text>
							</navigator>

						</view>
					</view>

				</view>

				<view class="flex-sub margin-top-xl">
					<view class="text-center">
						<text class="text-gray">©你想查的我都有</text>
					</view>
				</view>

			</view>
		</view>
		<zmm-watermark>

		</zmm-watermark>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				avatarUrl: "../../static/my/noUser.png",
				username: "未登录",
				isDark: this.isDark,
				client: this.client,
				state: null,
				isVIP: false,
			}
		},
		onLoad() {


		},
		onShow: function() {
			console.log('onShow')
			let _this = this
			const userInfo = _this.$store.state.userInfo
			if (userInfo.username) {
				_this.username = userInfo.username
			}
			_this.getInfo()

			
			if (userInfo.isVIP) {
				if (userInfo.isVIP == 'true') {
					_this.isVIP = true
				} else {
					_this.isVIP = false
				}
			} else {
				_this.isVIP = false
			}


		},
		methods: {
			showVIP() {
				this.$Router.navigateTo("/pages/user/vip")
			},
			showPublicCode() {
				uni.previewImage({
					urls: ['https://web.cloudduolc.cn/image%2Fgzhewm.jpg?id=' + Date.parse(new Date())],
				});
			},
			/**
			 * @description 获得信息
			 */
			getInfo() {
				let _this = this
				let option = {
					load: false
				}
				_this.$indexApi.getInfo().then(response => {
					if (response.data == null) {
						return
					}
					_this.state = response.data.state
				})
			},
			login: function() {
				this.$Router.navigateTo("/pages/bind/login/index")
			},
			chat: function() {
				uni.showToast({
					icon: 'none',
					title: '当前不支持网页和app，可前往小程序！',
					duration: 2000
				});
			},
			code() {
				uni.setClipboardData({
					data: 'https://gitee.com/zhengcloudtao/uni-app-search',
					showToast: false,
					success: function() {
						uni.showToast({
							icon: 'none',
							title: '网页地址已经复制，请自行到浏览器粘贴！',

						});
					}
				});
			},
			use() {
				uni.setClipboardData({
					data: 'https://www.bilibili.com/video/BV1UZ4y147HV',
					showToast: false,
					success: function() {
						uni.showToast({
							icon: 'none',
							title: '网页地址已经复制，请自行到浏览器粘贴！',

						});
					}
				});
			},
			clean: function() {
				let _this = this
				uni.showModal({
					title: '提示',
					content: '是否要删除全部缓存，（自定义课表也会被删除)!',
					success: function(res) {
						if (res.confirm) {
							_this.$store.commit("cleanAllCacheData")

						} else if (res.cancel) {

						}
					}
				});


			}
		},

	}
</script>
<style>
	button::after {
		border: none;
	}

	.vipbg {
		background-color: #F6F8ED;
	}


	.UCenter-bg {
		background-image: url(https://web.cloudduolc.cn/image/new10.png);
		background-size: cover;
		width: 100%;
		height: 395rpx;
		justify-content: center;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.headerbg {
		background-color: rgba(1, 205, 70, 1);
		height: 600rpx;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		position: relative;
		/* transform: scale(1.2); */
		transition: 0.8s;
	}

	.avatar {
		height: 150rpx;
		width: 150rpx;
		background-color: #eeeeee;
		border-radius: 50%;
		box-shadow: 0px 0px 8px 0px #ababaab0;
		background-size: cover;
		background-position: center;
	}

	.nickname {
		font-size: 18px;
		margin-top: 20px;
	}



	.main_list {
		margin-top: 36rpx;
		margin-bottom: 12rpx;
	}

	button {
		font-weight: 400 !important;
	}

	.rightIcon {
		width: 30rpx;
		height: 30rpx;
		margin-top: 17rpx;
	}
</style>
